import { defineStore } from 'pinia'

interface Settings {
  openAIKey: string
  aiEnabled: boolean
  voiceEnabled: boolean
}

export const useSettingsStore = defineStore('settings', {
  state: (): { settings: Settings } => ({
    settings: {
      openAIKey: localStorage.getItem('openai_key') || '',
      aiEnabled: true,
      voiceEnabled: true
    }
  }),
  
  actions: {
    updateSettings(settings: Partial<Settings>) {
      this.settings = { ...this.settings, ...settings }
      if (settings.openAIKey) {
        localStorage.setItem('openai_key', settings.openAIKey)
      }
    }
  }
}) 